<?php

namespace App\Http\Requests\V1;
/**
 * 管理员登录表单请求类
 *
 * Class AdminLoginRequest
 * @package App\Http\Requests\V1
 */
class AdminLoginRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return parent::authorize();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = parent::rules();
        $rules['code'] = 'bail|required|exists:admin_users,code,deleted_at,NULL';
        $rules['password'] = 'required';
        return $rules;
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array
     */
    public function messages()
    {
        $messages = parent::messages();
        $messages['code.required'] = '登录账号不能为空';
        $messages['code.exists'] = '登录账号不存在';
        $messages['password.required'] = '密码不能为空';
        return $messages;
    }

}
